
package com.carkeeper.search.listener;


import com.carkeeper.search.config.RabbitMQConfig;
import com.carkeeper.search.service.EsManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//服务下架监听器

@Component
public class ServiceDownListener {
    @Autowired
    private EsManagerService esManagerService;

    @RabbitListener(queues = RabbitMQConfig.SEARCH_DEL_QUEUE)
    public void getMessage(String message) {
        System.out.println("删除索引库监听类,接收到的Id:  " + message);
        //调用业务层删除索引库
        long l = Long.parseLong(message);
        esManagerService.delDataByServiceId(l);
    }

}

